home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / cli / mx2.arc / MENU.MOD < prev    next >
Text File  |  1988-06-11  |  2KB  |  89 lines

  1. MODULE menu;
  2.  
  3. IMPORT GEMVDIbase, AESGraphics, AESMenus, AESEvents, GEMAESbase;
  4. FROM   VDIInputs   IMPORT       ShowCursor,HideCursor;
  5.  
  6. FROM   SYSCALL  IMPORT EnableSpint;
  7.  
  8. FROM   MYLIB    IMPORT  InitResource,MenuTree,Terminate;
  9.  
  10. FROM   SYSTEM   IMPORT  ADR,ADDRESS;
  11. FROM   GEMDOS   IMPORT  OldTerm;
  12.  
  13. CONST
  14.        resourcefilename="MENU.RSC" ;
  15.        message         = 4;
  16. CONST
  17.      MENU1 = 0 ;
  18.   EXITMENU = 4 ;
  19.   DESKMENU = 5 ;
  20.      MEXIT = 17 ;
  21.     CURSOR = 19 ;
  22.  
  23.  
  24. VAR   resourcename                             : ARRAY [0..99] OF CHAR ;
  25.        result,handle                           : INTEGER ;
  26.        done                                    : BOOLEAN ;
  27.        eventbits                               : BITSET;
  28.        bufadr                                  : ADDRESS;
  29.  
  30. (* ------------------------------------------------------------------- *)
  31.  
  32. PROCEDURE quit;
  33. BEGIN
  34.         done:=TRUE;
  35. END     quit;
  36.  
  37. PROCEDURE Events ;
  38. (* Handle resource events *)
  39. VAR
  40.   pipeBuff : ARRAY [0..9] OF INTEGER ;
  41.   Menu     : INTEGER;
  42.  
  43.  
  44.   PROCEDURE SelectMenu( Menu, Item : INTEGER ) ;
  45.   BEGIN
  46.     CASE Menu OF
  47.          DESKMENU : CASE Item OF
  48.                          CURSOR :  ShowCursor(handle,0);  |
  49.                     ELSE
  50.                     END ; |
  51.          EXITMENU : done:=TRUE; |
  52.     ELSE
  53.     END ;
  54.     (* put header back normal*)
  55.     AESMenus.MenuTitleNormal(MenuTree,Menu,1) ;
  56.   END SelectMenu ;
  57.  
  58. BEGIN
  59.   done := FALSE ;
  60.   bufadr:=ADR(pipeBuff);
  61.   AESGraphics.GrafMouse(GEMAESbase.Arrow,NIL) ; (* put pointing mouse *)
  62.   REPEAT
  63.     eventbits:=BITSET(AESEvents.EventMultiple(48,0,0,0,
  64.                             0,0,0,0,0,
  65.                             0,0,0,0,0,
  66.                             bufadr,
  67.                             0,0,
  68.                             result,result,result,result,
  69.                             result,result));
  70.     IF message IN eventbits THEN
  71.     CASE pipeBuff[0] OF         (* message type *)
  72.       GEMAESbase.MenuSelected   : SelectMenu(pipeBuff[3],pipeBuff[4]) ; |
  73.     ELSE
  74.     END ;
  75.     END;
  76.   UNTIL done ;
  77.   HideCursor(handle);
  78. END Events ;
  79.  
  80. BEGIN
  81.         handle:=InitResource(resourcefilename,MENU1); 
  82.         IF handle#(-1) THEN 
  83.            done:=EnableSpint(1,quit,NIL);
  84.            Events; 
  85.            Terminate;
  86.         END;
  87.         OldTerm;
  88. END     menu.
  89.